<%--
  Created by IntelliJ IDEA.
  User: xiaoxiang
  Date: 2021/10/25
  Time: 14:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>首页</title>
</head>
<body>

<%
    Cookie[] cook = request.getCookies();//获取本地所有的Cookie对象
    String[] userMessage = new String[] { "", "" }; //用户存储从cookie中获取的用户名和密码
    if (cook != null) {
        for (int i = 0; i < cook.length; i++) {
            if (cook[i].getName().equals("userInfo")) {
                userMessage = cook[i].getValue().split("#");//通过分割split获取用户名和密码.
            }

        }
    }
%>



<form action="login" method="get">
   <div align="left">
    用户名： <input type="text" name="username" value="<%=userMessage[0]%>">
    密&nbsp;&nbsp;&nbsp;&nbsp;码：<input type="passwod" name="password" value="<%=userMessage[1]%>">

   </div><br />
    <input type="submit" value="登录">
</form>




</body>
</html>
